In the formation of metal gates and the respective gate contact plugs for Fin Field-Effect Transistors (FinFETs), the metal gates are often recessed, and hard masks are filled into the recesses formed due to the recessing of the metal gates. Some parts of the hard masks are subsequently removed to form contact openings, through which the metal gates are exposed. The gate contact plugs are formed to connect to the metal gates.
The recessing of the hard masks results in the metal gate loss, which requires the metal gates to be formed higher than their final heights in order to compensate for the lost height. The increased height of the metal gates causes difficulty in the gap-filling for forming the metal gates. Also, the recessing of the hard masks suffers from pattern-loading effect in the etching of the hard masks, and the pattern-loading effect causes some portions of the metal gates to be recessed more than other metal gates.